﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;

namespace StyleMVVM.DependencyInjection
{
	/// <summary>
	/// Compares to two export strategies based on the export environment of the container.
	/// </summary>
	/// <param name="exportA"></param>
	/// <param name="exportB"></param>
	/// <param name="environment"></param>
	/// <returns></returns>
	public delegate int ExportComparison(IExportStrategy exportA, IExportStrategy exportB, ExportEnvironment environment);

	/// <summary>
	/// This delegate allows you to construct export manually rather than letting the container figure out how to provide an export
	/// </summary>
	/// <param name="container"></param>
	/// <param name="injectionContext"></param>
	/// <param name="cosntructorParameters"></param>
	/// <returns></returns>
	public delegate object ExportFunction(
		IDependencyInjectionContainer container,
		IInjectionContext injectionContext,
		[ReadOnlyArray] object[] cosntructorParameters);

	/// <summary>
	/// This delegate allows you to provide a global condition for the container
	/// </summary>
	/// <param name="container"></param>
	/// <returns></returns>
	public delegate string ExportConditionProviderDelegate(IDependencyInjectionContainer container);

	/// <summary>
	/// This delegate is called to provide an export condition value, where the condition name is the key and the condition value is defined as value
	/// </summary>
	/// <param name="container"></param>
	/// <returns></returns>
	public delegate KeyValuePair<string, object>? ExportConditionValueProviderDelegate(
		IDependencyInjectionContainer container);

	/// <summary>
	/// This delegate is used to filter out if an export should be included in a LocateAll
	/// </summary>
	/// <param name="exportStrategy">export to filter</param>
	/// <returns>true include the export, false if you do not want to include the export in the result set</returns>
	public delegate bool FilterExport(IExportStrategy exportStrategy);

	/// <summary>
	/// Using this delegate you can provide custom logic to the activation process overriding 
	/// </summary>
	/// <param name="container"></param>
	/// <param name="injectionContext"></param>
	/// <param name="injectedObject"></param>
	/// <returns>return the initial object or return a wrapping object</returns>
	public delegate object EnrichWithDelegate(
		IDependencyInjectionContainer container, IInjectionContext injectionContext, object injectedObject);
}
